$(function(){
    var fn = ABUS.Fn;
    var param = window.__param__;

    $("#order_info").renderTemp(param);
    fn.get({
        url:"/common/order/childOrders",
        data:param,
        success:function (data) {
            if(data.result !== 1) return false;
            data.currentStepIndex = param.stepIndex;
            $("#progress_list_1").renderTemp(data);
            $(".moving_line_2").each(function () {
                $(this).height($(this).parents("li").height() - $(this).prev('div').height())
            });
            new IScroll('#progress_list_1', { mouseWheel: true });
            // $('#progress_list_1').find("ul li:has(.circle_1):first").nextAll('li')
            //     .find(".circle_1").toggleClass("circle_1 circle_4").find("span").toggleClass("colorfff colora29").end().end()
            //     .find(".progress_status span").toggleClass("color17d colord8");
            data = data.data;
            $('.start_list').on("touchend", function () {

                fn.confirm({
                    onSubmit: function () {
                        fn.get({
                            url:"/common/order/acceptChildOrder",
                            data:{
                                orderId:param.orderId,
                                childOrderId:$('#progress_list_1').find('[data-acceptChildOrder]').attr('data-acceptChildOrder')
                            },
                            success:function (data) {
                                if(data.result === 1){
                                    fn.page_goto({
                                        url:"./yewuyuan_shouye.html"
                                    })
                                }
                            }
                        })
                        fn.closeModal();
                    },
                    onCancel: function () {
                        fn.closeModal();
                    }
                })

            })
        }
    });

    document.addEventListener('touchmove', function (e) { e.preventDefault();},  { passive: false } );

});